
package com.ruoyi.busi.guide.service.impl;

import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.ruoyi.busi.guide.domain.Feedback;
import com.ruoyi.busi.guide.mapper.FeedbackMapper;
import com.ruoyi.busi.guide.service.IFeedbackService;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 导师评价Service业务层处理
 */
@Service
public class FeedbackServiceImpl extends ServiceImpl<FeedbackMapper, Feedback> implements IFeedbackService {

    private final FeedbackMapper feedbackMapper;

    public FeedbackServiceImpl(FeedbackMapper feedbackMapper) {
        this.feedbackMapper = feedbackMapper;
    }

    @Override
    public List<Feedback> selectByMentorId(Long mentorId) {
        if (mentorId == null) {
            throw new IllegalArgumentException("导师ID不能为空");
        }
        return feedbackMapper.selectByMentorId(mentorId);
    }

    @Override
    public List<Feedback> selectByRatingRange(Integer minRating, Integer maxRating) {
        if (minRating == null || maxRating == null) {
            throw new IllegalArgumentException("评分范围不能为空");
        }
        if (minRating > maxRating) {
            throw new IllegalArgumentException("最小评分不能大于最大评分");
        }
        return feedbackMapper.selectByRatingRange(minRating, maxRating);
    }

    @Override
    public boolean deleteFeedbackByIds(List<Long> feedbackIds) {
        return this.removeByIds(feedbackIds);
    }
}
